CmdUtils.CreateCommand({
  name: "resolve-doi", 
  homepage: "http://chem-bla-ics.blogspot.com/",
  author: { name: "Egon Willighagen", email: "egon.willighagen@gmail.com"}, 
  description: "Resolves a DOI into a URL",
  license: "GPL",
  takes: {"doi": noun_arb_text},

  preview: function( pblock, doi ) {
    var msg = 'Inserts a URL for the DOI: <i>${doi}</i>';
    var d = doi.text || CmdUtils.getSelection();
    pblock.innerHTML = CmdUtils.renderTemplate(msg, {doi: d});
  },

  execute: function( doi ) {
    var msg = '<a href="http://dx.doi.org/${doi}">${doi}</a>';
    var d = doi.text || CmdUtils.getSelection();
    var newText = CmdUtils.renderTemplate(msg, {doi: d});
    CmdUtils.setSelection(newText);
  }
})

